import request from '@/utils/request'
/**
 * 查企业页面中  获取公司列表信息api
 * @returns
 */
export const getCompanyListApi = (page, page_size) => {
  return request({
    url: '/company/companyall',
    params: {
      page,
      page_size
    },
    method: 'get'
  })
}

/**
 * 查看公司详情
 * @param {*} data
 * @returns
 */
export const getCompanyDetailApi = (data) => {
  return request({
    url: '/company/companyinfo',
    params: {
      cname: data
    },
    method: 'get'
  })
}
/**
 * 搜索框查找公司
 * @returns
 */
export const searchCompanyDetailListApi = () => {
  return request({
    url: '/company/keys',
    method: 'get'
  })
}
/**
 * 获取 资质失效
 * @returns
 */
export const getExpireCompanyListApi = () => {
  return request({
    url: '/company/expire',
    method: 'get'
  })
}

/**
 * 获取一级资质到期公司
 * @returns
 */
export const getFirstExpireCompanyListApi = (page, page_size, roleid) => {
  return request({
    url: '/company/first_expire',
    params: {
      page,
      page_size,
      roleid
    },
    method: 'get'
  })
}

/**
 * 获取二级资质到期公司
 * @returns
 */
export const getSecondExpireCompanyListApi = (page, page_size, roleid) => {
  return request({
    url: '/company/second_expire',
    params: {
      page,
      page_size,
      roleid
    },
    method: 'get'
  })
}

/**
 * 获取三级资质到期公司
 * @returns
 */
export const getThirdExpireCompanyListApi = (page, page_size, roleid) => {
  return request({
    url: '/company/third_expire',
    params: {
      page,
      page_size,
      roleid
    },
    method: 'get'
  })
}

/**
 * 获取不分等级资质到期公司
 * @returns
 */
export const getForthExpireCompanyListApi = (page, page_size, roleid) => {
  return request({
    url: '/company/forth_expire',
    params: {
      page,
      page_size,
      roleid
    },
    method: 'get'
  })
}

/**
 * 获取 施工资质 列表
 * @returns
 */
export const getConstructionListApi = (page, page_size) => {
  return request({
    url: '/company/construction_unit',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取 承装修式 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getDecorationListApi = (page, page_size) => {
  return request({
    url: '/company/decoration_style',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取 设计资质 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getDesignListApi = (page, page_size) => {
  return request({
    url: '/company/design',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取 监理资质 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getMonitorListApi = (page, page_size) => {
  return request({
    url: '/company/monitor',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取 地质灾害资质 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getGeologicalDisasterListApi = (page, page_size) => {
  return request({
    url: '/company/geology',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取  我的意向 列表
 * @param {*} data
 * @returns
 */
export const getMyIntentionListApi = (page, page_size) => {
  return request({
    url: '/company/intended',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取 小组意向 列表
 * @param {*} page
 * @param {*} page_size
 * @param {*} roleid
 * @returns
 */
export const getGroupIntentionListApi = (page, page_size, roleid) => {
  return request({
    url: '/company/group_intended',
    method: 'get',
    params: {
      page,
      page_size,
      roleid
    }
  })
}
/**
 * 获取 全部意向 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getAllIntentionListApi = (page, page_size, depart_id) => {
  return request({
    url: '/company/all_intended',
    method: 'get',
    params: {
      page,
      page_size,
      depart_id
    }
  })
}
/**
 * 导出 我的意向客户
 * @returns
 */
export const getMyIntentionExcelApi = () => {
  return request({
    url: '/company/export_self',
    method: 'get'
  })
}
/**
 * 导出 小组意向客户
 * @returns
 */
export const getGroupIntentionExcelApi = () => {
  return request({
    url: '/company/export_group',
    method: 'get'
  })
}

/**
 * 导出 全部意向客户
 * @returns
 */
export const getAllIntentionExcelApi = () => {
  return request({
    url: '/company/export_all',
    method: 'get'
  })
}
/**
 * 添加 成交客户
 * @param {*} data
 * @returns
 */
export const addSuccessCustomerApi = (data) => {
  return request({
    url: '/company/transaction',
    method: 'post',
    data
  })
}

/**
 * 删除意向客户
 * @returns
 */
export const delIntentionApi = (cname, company_id) => {
  return request({
    url: '/company/del_intended',
    method: 'delete',
    data: {
      cname,
      company_id
    }
  })
}
/**
 * 获取 签单下拉框业务种类 类型
 * @param {*} data
 * @returns
 */
export const getBusinessTypeListApi = (data) => {
  return request({
    url: '/company/business_name',
    method: 'get',
    params: {
      type_id: data
    }
  })
}
/**
 *  编辑跟进业务记录
 * @param {*} data
 * @returns
 */
export const editFollowApi = (company_id, text) => {
  return request({
    url: '/company/follow_up',
    method: 'post',
    data: {
      company_id: company_id,
      text: text
    }
  })
}
/**
 * 获取 跟进业务记录结果
 * @param {*} company_id
 * @returns
 */
export const getFollowApi = (company_id) => {
  return request({
    url: '/company/follow_log',
    method: 'get',
    params: {
      company_id
    }
  })
}
/**
 * 获取添加意向业务列表  下拉框
 * @param {*} type_id
 * @returns
 */
export const getSelectValuesApi = (type_id) => {
  return request({
    url: '/company/business_name',
    method: 'get',
    params: {
      type_id
    }
  })
}
/**
 * 获取 我的成交 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getMyDealListApi = (page, page_size) => {
  return request({
    url: '/company/self_deal',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}
/**
 * 获取 小组成交 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getGroupDealListApi = (page, page_size) => {
  return request({
    url: '/company/group_deal',
    method: 'get',
    params: {
      page,
      page_size
    }
  })
}

/**
 * 获取 全部成交 列表
 * @param {*} page
 * @param {*} page_size
 * @returns
 */
export const getAllDealListApi = (page, page_size, depart_id) => {
  return request({
    url: '/company/all_deal',
    method: 'get',
    params: {
      page,
      page_size,
      depart_id
    }
  })
}

/**
 * 获取 全部意向业务列表下拉框 用于添加自己的意向客户
 * @param {*} data
 * @returns
 */
export const getAllSelectValuesApi = () => {
  return request({
    url: '/company/display_keys',
    method: 'get'
  })
}

/**
 * 手动添加 个人意向客户
 * @param {*} data
 * @returns
 */
export const addSelfCustomerApi = (data) => {
  return request({
    url: '/company/selfadd',
    method: 'post',
    data
  })
}
/**
 * 意向客户excel导入
 * @param {*} data
 * @returns
 */
export const batchCustomerApi = (lists) => {
  return request({
    url: '/company/importExcel',
    method: 'post',
    data: {
      lists
    }
  })
}
// 客户移交
/**
 *  获取移交的客户
 * @returns
 */
export const getTransfersUserListApi = () => {
  return request({
    url: '/company/remove_user',
    method: 'get'
  })
}
/**
 * 移交客户
 * @returns
 */
export const transfersCompanyApi = (userid, companyid) => {
  return request({
    url: '/company/remove',
    method: 'post',
    data: {
      userid,
      companyid
    }
  })
}
